From: Florian Müllner Date: Fri, 5 Oct 2018 17:09:28 +0000 (+0200) Subject: automountManager: Explicitly track active operations X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~929^2^2~6 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=e2f6a1980d661c27c0d0738b361a7a8dfe4f5074;p=gnome-shell.git automountManager: Explicitly track active operations As a mount operation's UI may be reused (for example after mistyping the password), we only close the operation once the mount has finished (successfully or with error). We therefore need to track ongoing operations, which we currently do by monkey-patching the corresponding volume object. However while the underlying GVolume object indeed remains the same through-out the operation, the JS wrapper object isn't referenced anywhere and may thus be garbage collected, resulting in a stuck dialog. Fix this issue by tracking active operations explicitly, so that all involved objects are referenced until the end of the operation. https://gitlab.gnome.org/GNOME/gnome-shell/issues/565 --- diff --git a/js/ui/components/automountManager.js b/js/ui/components/automountManager.js index a6cd85792..3e2dcd923 100644 --- a/js/ui/components/automountManager.js +++ b/js/ui/components/automountManager.js @@ -25,6 +25,7 @@ var AutomountManager = new Lang.Class({ _init() { this._settings = new Gio.Settings({ schema_id: SETTINGS_SCHEMA }); this._volumeQueue = []; + this._activeOperations = new Map(); this._session = new GnomeSession.SessionManager(); this._session.connectSignal('InhibitorAdded', this._InhibitorsChanged.bind(this)); @@ -182,7 +183,7 @@ var AutomountManager = new Lang.Class({ this._allowAutorun(volume); let mountOp = operation ? operation.mountOp : null; - volume._operation = operation; + this._activeOperations.set(volume, operation); volume.mount(0, mountOp, null, this._onVolumeMounted.bind(this)); @@ -219,7 +220,8 @@ var AutomountManager = new Lang.Class({ }, _reaskPassword(volume) { - let existingDialog = volume._operation ? volume._operation.borrowDialog() : null; + let prevOperation = this._activeOperations.get(volume); + let existingDialog = prevOperation ? prevOperation.borrowDialog() : null; let operation = new ShellMountOperation.ShellMountOperation(volume, { existingDialog: existingDialog }); @@ -227,8 +229,11 @@ var AutomountManager = new Lang.Class({ }, _closeOperation(volume) { - if (volume._operation) - volume._operation.close(); + let operation = this._activeOperations.get(volume); + if (!operation) + return; + operation.close(); + this._activeOperations.delete(volume); }, _allowAutorun(volume) {